#!/usr/bin/python
# -*- coding: utf-8 -*-

#-------------------------------------------------
#Create At: 2008-6-19 上午12:54:39 
#Create By: Fla.sam
#
#DESC: proxy auto config  
#
#-------------------------------------------------

class Pac:
    def __init__( self ):
        self.mode = ''
        self.pac_content_template = '''function FindProxyForURL(url, host) {
    //except my localhost All other requests go through google app engine proxy
    if (isInNet(host, '127.0.0.1', '255.255.255.0')) {
        return "DIRECT";}
    
    //DIRECT    
    %s
    
    //PROXY
    %s
         
    // default  
    return "PROXY 127.0.0.1:3128;}'''
        
    def getMode(self):
        return self.mode
    
    def setMode(self, mode=''):
        self.mode = mode
    
    def renderPac(self):
        pass
    
    def getPac(self):
        self.renderPac()
        return self.pac_content_template % ('', '')
